import React, { useEffect, useRef } from 'react'


//感想，返回值的格式要对好，返回是数组格式的就要用数组接，否则错误很难改
export default(props)=>{
  const c1 = useRef(null)
  var option={}
  useEffect(()=>{
  var myChart = echarts.init(c1.current)
  console.log(props.data,'888888')
  if(props.data){
    option=props.data
    myChart.setOption(option);
  }
  },[props])
return <div ref={c1} style={{height:'300px'}}></div>
}
